home *** CD-ROM | disk | FTP | other *** search
- Music:Start
- New(Response,Row,Col,Forg,Back,Tone,Time)
- Response=Msg:Add("Beautiful Music")
- This 42 line program generates random music. Just in case you
- do not like random music, I have made the program display a
- tapestry of color proclaiming "Beautiful Music" to convince you.
-
- It is a demonstration for these functions:
-
- Num:Rand(Lo,Hi) -Generates random numbers
- Jorf:Sound(Tone,Duration) -Plays a musical tone
- Win:Attr("Forground/Background") -Changes screen colors
-
- You are encouraged to change this program around to change the
- music and the colors. For instance make the music higher or
- lower, faster or slower, and make the colors follow the rainbow
- instead of being random. (We wasted 18 lines just on this
- message . . . only 20 lines to go!)
-
- You could spend hours here, making Beautiful Music!
-
- If (Response==Ok)
- Win:Add ("Beautiful Music", 2, 3, 22, 75, Here)
- Win:Msg ("Press any key for relief . . .")
- While (Kbd:Hit()==0) | Do until they give up
- ++Row | Next row
- If (Row > Win:Ptr->Len) | If too low
- Row=1 | back to row 1
- For (Col = 0 thru 4) | Display "B.. Music 5 times
- Forg=Num:Rand(0,15)
- Back=Num:Rand(0,15)
- Move:To(Row,(Col*15+1))
- Win:Attr(Forg+"/"+Back)
- Str:Put("Beautiful Music")
- Time=Num:Btw(Time*Num:Rand(-4,4),1,8)
- Tone=Tone+((Tone/12)*Num:Rand(-2,2))
- If (Tone<60 Or Tone > 1400)
- Tone=440
- Jorf:Sound(Tone,Time*10)
- Return (Ok)
-
- usic:Start
- New(Response,Row,Col,Forg,Back,Tone,Time)
- Response=Msg:Add("Beautiful Music")
- This 42 line program generates random music. Just in case you
- do not like random music, I have made the program display a
- tapestry of color proclaiming "Beautiful Music" to convince you.
-
- It is a demonstration for these functions:
-
- Num:Rand(Lo,Hi) -Generates random numbers
- Jorf:Sound(Tone,Duration) -Plays a musical tone
- Win:Attr("Forground/Background") -Changes screen colors
-
- You are encouraged to change this program around to change the
- music and the colors. For instance make the music higher or
- lower, faster or slower, and make the colors follow the rainbow
- instead of being random. (We wasted 18 lines just on this
- message . . . only 20 lines to go!)
-
- You could spend hours here, making Beautiful Music!
-
- If (Response==Ok)
- Win:Add ("Beautiful Music", 2, 3, 22, 75, Here)
- Win:Msg ("Press any key for relief . . .")
- While (Kbd:Hit()==0) | Do until they give up
- ++Row | Next row
- If (Row > Win:Ptr->Len) | If too low
- Row=1 | back to row 1
- For (Col = 0 thru 4) | Display "B.. Music 5 times
- Forg=Num:Rand(0,15)
- Back=Num:Rand(0,15)
- Move:To(Row,(Col*15+1))
- Win:Attr(Forg+"/"+Back)
- Str:Put("Beautiful Music")
- Time=Num:Btw(Time*Num:Rand(-4,4),1,8)
- Tone=Tone+((Tone/12)*Num:Rand(-2,2))
- If (Tone<60 Or Tone > 1400)
- Tone=440
- Jorf:Sound(Tone,Time*10)
- Return (Ok)
-
-